<?xml version="1.0" encoding="ISO-8859-1"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                template="template.xhtml">
    <ui:define name="body">
        <h:form>
            <p:messages/>
            <p:panel header="Mail attachments">
                <h:panelGrid columns="2">
                    <h:outputLabel value="Upload"/>
                    <p:fileUpload fileUploadListener="#{mailListActions.attachmentContainer.uploadFile}"
                                  auto="true" update="attachments remove"/>        

                    <h:selectOneMenu id="attachments" value="#{mailListActions.attachmentContainer.selectedAttachment}">
                        <f:selectItems value="#{mailListActions.attachmentContainer.attachments}"/>
                        <f:ajax render="@form"/>
                    </h:selectOneMenu>

                    <p:commandButton id="remove" value="remove" actionListener="#{mailListActions.attachmentContainer.remove}"
                                     update="@form"
                                     disabled="#{mailListActions.attachmentContainer.selectedAttachment == null}"/>

                </h:panelGrid>

                <h:commandButton value="Go to edit" immediate="true"
                                 action="mail_edit.xhtml?faces-redirect=true"/>
            </p:panel>
        </h:form>

    </ui:define>
</ui:composition>